package com.duojuhe.common.utils.printwriter;

import java.io.PrintWriter;

/**
 * 向前端输出一个html页面内容提示
 */
public class PrintWriterUtil {

    /**
     * 向前端输出一个html页面内容提示
     *
     * @param pw
     * @param str
     */
    public static void pwPrintln(PrintWriter pw, String str) {
        String string = "<!DOCTYPE HTML>" +
                "<html>" +
                "<head>" +
                "    <title>错误提示</title>" +
                "    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, maximum-scale=1\">" +
                "    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>" +
                "    <style type=\"text/css\">" +
                "        body {" +
                "            font-family: 'Love Ya Like A Sister', cursive;" +
                "        }" +
                "" +
                "        body {" +
                "            background: #eaeaea;" +
                "        }" +
                "" +
                "        .wrap {" +
                "            width: 100%;" +
                "        }" +
                "" +
                "        .logo {" +
                "            text-align: center;" +
                "            margin-top: 50px;" +
                "        }" +
                "" +
                "        .logo img {" +
                "            width: 200px;" +
                "        }" +
                "" +
                "        .logo p {" +
                "            color: #272727;" +
                "        }" +
                "" +
                "        .logo p span {" +
                "            color: lightgreen;" +
                "        }" +
                "" +
                "        .sub a {" +
                "            color: #fff;" +
                "            background: #68c0f2;" +
                "            text-decoration: none;" +
                "            padding: 5px 10px;" +
                "            font-size: 13px;" +
                "            font-family: arial, serif;" +
                "            font-weight: bold;" +
                "        }" +
                "    </style>" +
                "</head>" +
                "" +
                "" +
                "<body>" +
                "<div class=\"wrap\">" +
                "    <div class=\"logo\">" +
                "        <img src=\"\"/>" +
                "        <div class=\"center\">" +
                "            <div class=\"cartoon\"></div>" +
                "            <div class=\"text\">" +
                "                <h2>hi，你好</h2>" +
                "                <p style=\"font-size: 18px; color: red; white-space: nowrap;\">" + str + "</p>" +
                "                <p class=\"sub\">" +
                "                    <a href=\"javascript:history.back(-1)\" class=\"refresh\">返回上一页</a>" +
                "                </p>" +
                "            </div>" +
                "        </div>" +
                "    </div>" +
                "</div>" +
                "</body>";
        pw.println(string);
    }


    /**
     * 向前端输出一个字符串内容提示
     *
     * @param pw
     * @param str
     */
    public static void pwPrintlnStr(PrintWriter pw, String str) {
        pw.print(str);
    }
}
